{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #a1{color: red}
        #a2{color: green}
    </style>
</head>
<body>
    <label>请输入账号: <input type="text" id="username" required></label><br>
    <label>请输入密码: <input type="password" id="passwordi" required></label><br>
    <label>请确认密码: <input type="password" id="passwordc" required></label><br>
    <button id="s1">提交</button>
    <p id="a1"></p>
    <p id="a2"></p>
</body>
<script src="{% static 'js文件/jquery.js' %}"></script>
<script>
    $("#s1").click
    (
        function ()
        {
            let name=$("#username").val();
            let passwordi=$("#passwordi").val();
            let passwordc=$("#passwordc").val();
            $.ajax
            ({
            type:'post',
            url:'/rigister/',
            data:{username:name,passwordi:passwordi,passwordc:passwordc},
            success:function (res){
                console.log(res);
                $("#a2").text("注册成功");
            },
            error:function (error){
                console.log(error);
                $("#a1").text("账号已被注册或两次密码输入不相同");}
            })
        }
    )
</script>
</html>